/*
 * Copyright 2017 hv0912
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.vimhe.ezimp2;

import java.util.HashSet;
import java.util.Set;

/**
 * 常量表
 *
 * @author Vimhe
 */
public final class Constants {

    /**
     * 文件格式
     */
    public static final String EXCEL_FORMAT_XLS = "xls";
    public static final String EXCEL_FORMAT_XLSX = "xlsx";
    public static final Set<String> EXCEL_FORMAT = new HashSet<>(2);

    /**
     * 验证器名称
     */
    public static final String VALIDATOR_NAME_NULLABLE = "nullable";
    public static final String VALIDATOR_NAME_STRING_LENGTH = "stringLength";
    public static final String VALIDATOR_NAME_STRING_MIN_LENGTH = "stringMinLength";
    public static final String VALIDATOR_NAME_STRING_MAX_LENGTH = "stringMaxLength";
    public static final String VALIDATOR_NAME_STRING_START_WITH = "stringStartWith";
    public static final String VALIDATOR_NAME_STRING_END_WITH = "stringEndWith";
    public static final String VALIDATOR_NAME_STRING_CONTAINS = "stringContains";
    public static final String VALIDATOR_NAME_STRING_EQUALS = "stringEquals";
    public static final String VALIDATOR_NAME_STRING_EQUALS_IGNORE_CASE = "stringEqualsIgnoreCase";
    public static final String VALIDATOR_NAME_STRING_SEPARATOR = "stringSeparator";
    public static final String VALIDATOR_NAME_STRING_PATTERN = "stringPattern";
    public static final String VALIDATOR_NAME_NUMBER_EQUALS = "numberEquals";
    public static final String VALIDATOR_NAME_NUMBER_MIN = "numberMin";
    public static final String VALIDATOR_NAME_NUMBER_MAX = "numberMax";
    public static final String VALIDATOR_NAME_DATETIME_START = "datetimeStart";
    public static final String VALIDATOR_NAME_DATETIME_END = "datetimeEnd";
    public static final String VALIDATOR_NAME_DATETIME_BEFORE = "datetimeBefore";
    public static final String VALIDATOR_NAME_DATETIME_AFTER = "datetimeAfter";

    /**
     * 格式转换器名称
     */
    public static final String FORMATTER_NAME_NUMBER = "number";
    public static final String FORMATTER_NAME_DATE = "date";

    /**
     * 布尔值
     */
    public static final String BOOLEAN_VALUE_TRUE = "true";
    public static final String BOOLEAN_VALUE_FALSE = "false";

    /**
     * 数据类型
     */
    public static final String CLASS_TYPE_STRING = "java.lang.String";
    public static final String CLASS_TYPE_BOOLEAN = "java.lang.Boolean";
    public static final String CLASS_TYPE_BYTE = "java.lang.Byte";
    public static final String CLASS_TYPE_SHORT = "java.lang.Short";
    public static final String CLASS_TYPE_INTEGER = "java.lang.Integer";
    public static final String CLASS_TYPE_LONG = "java.lang.Long";
    public static final String CLASS_TYPE_FLOAT = "java.lang.Float";
    public static final String CLASS_TYPE_DOUBLE = "java.lang.Double";
    public static final String CLASS_TYPE_BIG_INTEGER = "java.math.BigInteger";
    public static final String CLASS_TYPE_BIG_DECIMAL = "java.math.BigDecimal";
    public static final String CLASS_TYPE_DATE = "java.util.Date";
    public static final String CLASS_TYPE_SQL_DATE = "java.sql.Date";
    public static final String CLASS_TYPE_SQL_TIMESTAMP = "java.sql.Timestamp";
    public static final Set<String> CLASSES_TYPE_NUMBER = new HashSet<>(8);
    public static final Set<String> CLASSES_TYPE_TIME = new HashSet<>(3);
    public static final Set<String> CLASSES_TYPE = new HashSet<>(13);

    static {
        // 文件格式
        EXCEL_FORMAT.add(EXCEL_FORMAT_XLS);
        EXCEL_FORMAT.add(EXCEL_FORMAT_XLSX);

        // 数据类型-数字
        CLASSES_TYPE_NUMBER.add(CLASS_TYPE_BYTE);
        CLASSES_TYPE_NUMBER.add(CLASS_TYPE_SHORT);
        CLASSES_TYPE_NUMBER.add(CLASS_TYPE_INTEGER);
        CLASSES_TYPE_NUMBER.add(CLASS_TYPE_LONG);
        CLASSES_TYPE_NUMBER.add(CLASS_TYPE_FLOAT);
        CLASSES_TYPE_NUMBER.add(CLASS_TYPE_DOUBLE);
        CLASSES_TYPE_NUMBER.add(CLASS_TYPE_BIG_INTEGER);
        CLASSES_TYPE_NUMBER.add(CLASS_TYPE_BIG_DECIMAL);

        // 数据类型-日期时间
        CLASSES_TYPE_TIME.add(CLASS_TYPE_DATE);
        CLASSES_TYPE_TIME.add(CLASS_TYPE_SQL_DATE);
        CLASSES_TYPE_TIME.add(CLASS_TYPE_SQL_TIMESTAMP);

        // 数据类型
        CLASSES_TYPE.add(CLASS_TYPE_STRING);
        CLASSES_TYPE.add(CLASS_TYPE_BOOLEAN);
        CLASSES_TYPE.addAll(CLASSES_TYPE_NUMBER);
        CLASSES_TYPE.addAll(CLASSES_TYPE_TIME);
    }

}
